<?php

declare(strict_types=1);

namespace App\Events;

use GSC\Route;
use Swoole\Http\Request;
use Swoole\Http\Response;
use Swoole\Server;

class HTTP
{
//    public static function onRequest(Request $request, Response $response)
//    {
//        return Route::getInstance()->dispatch($request, $response);
//    }

    public static function onTask(Server $server, $task_id, $reactor_id, $data)
    {
        echo "Tasker进程接收到数据#{$server->worker_id}\tonTask: [PID={$server->worker_pid}]:{$task_id} task_id=$reactor_id" . PHP_EOL;
        $server->finish($data);
    }

    public static function onFinish(Server $server, $task_id, $data)
    {
        echo "Task#$task_id finished" . PHP_EOL;
    }
}
